
import java.util.ArrayList;
import java.util.HashMap;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author matrosj0
 */

class MinutesWeekYear{
    private int minutesYear;
    private int minutesWeek;

    public MinutesWeekYear() {
        this.minutesYear = 0;
        this.minutesWeek = 0;
    }

    public int getMinutesWeek() {
        return minutesWeek;
    }

    public int getMinutesYear() {
        return minutesYear;
    }

    public void setMinutesWeek(int minutesWeek) {
        this.minutesWeek = minutesWeek;
    }

    public void setMinutesYear(int minutesYear) {
        this.minutesYear = minutesYear;
    }

    public void addMinutes(int minutes)
    {
        minutesWeek += minutes;
        minutesYear += minutes;
    }
}

public class DriverMinutesWorked {

    private final static int MAX_MINS_YEAR = 525600;
    private final static int MAX_MINS_WEEK = 10080;

    public static HashMap<Integer, MinutesWeekYear> driverInfo;

    static {
        driverInfo = new HashMap<Integer, MinutesWeekYear>();
    }

    

    public DriverMinutesWorked() {
        ArrayList<Driver> drivers = Driver.getDrivers();
        for (int i = 0; i < drivers.size(); i++)
        {
            //System.out.println("Placing driver: " + drivers.get(i) + "into hashmap");
            driverInfo.put(drivers.get(i).getDriverID(), new MinutesWeekYear());
            //System.out.println();
        }
    }

    public static MinutesWeekYear getInfo(Driver driver)
    {
        return driverInfo.get(driver.getDriverID());
    }

    /*public void addMinutesYear(int minutes)
    {
        minutesYear += minutes;
    }*/

    public void addMinutes(Driver d, int minutes)
    {
        //System.out.println("For driver " + d.getDriverID() + " minutes before " + driverInfo.get(d.getDriverID()).getMinutesWeek());

        driverInfo.get(d.getDriverID()).addMinutes(minutes);
        
         //System.out.println("For driver " + d.getDriverID() + " minutes after " + driverInfo.get(d.getDriverID()).getMinutesWeek());
    }

    public int getMinutesWeek(Driver d) {
        return driverInfo.get(d.getDriverID()).getMinutesWeek();
    }

    public int getMinutesYear(Driver d) {
        return driverInfo.get(d.getDriverID()).getMinutesYear();
    }

    /*@Override
    public String toString() {
        return "DriverMinutesWorked{" + "minutesYear=" + minutesYear + "minutesWeek=" + minutesWeek + '}';
    }*/

    
    
}
